from osgeo import gdal
gdal.UseExceptions()

ds:gdal.Dataset = gdal.Open('test.tif')
ds.GetDriver()